﻿using System;
using AccessControl.Common;
using AccessControl.DataAcess;


namespace AccessControl.Business
{
    public class FingerTemplateBusiness
    {

        public static AccessControlDS.tblFingerTemplateDataTable SelectAll()
        {
            return FingerTemplateAccess.SelectAll();
        }

        public static AccessControlDS.tblFingerTemplateDataTable SelectByFilter(string filter)
        {
            return FingerTemplateAccess.SelectByFilter(filter);
        }

        public static void Insert(AccessControlDS.tblFingerTemplateRow row)
        {
            FingerTemplateAccess.Insert(row);
        }

        public static void Update(AccessControlDS.tblFingerTemplateRow row)
        {
            FingerTemplateAccess.Update(row);
        }

        public static void Delete(AccessControlDS.tblFingerTemplateRow row)
        {
            FingerTemplateAccess.Delete(row);
        }

        public static Boolean CheckIfFingerExist(string pkPerson,byte fingerIndex)
        {
            var result=SelectByFilter(String.Format("fkPerson='{0}' AND TemplateFinger={1}",pkPerson,fingerIndex));
            return (result != null)&& (result.Count>0);
        }
    }
}
